package com.ziroom.crm.rock.spring.config;

import com.ziroom.crm.mq.core.config.MqConfig;
import com.ziroom.crm.mq.core.reconsume.ReConsumeInitFunc;
import com.ziroom.crm.mq.core.reconsume.ReConsumeInvoker;
import lombok.Data;

@Data
@SuppressWarnings("ALL")
public class MqReconsumeConfig {

    /**
     * 消费定时轮训毫秒数
     * 默认5分钟
     *
     * @see ReConsumeInitFunc#DEFAULT_SLEEP_TIME
     */
    private String sleepMilli;

    /**
     * 消费端持久化重试，每次重试数据数量
     * 默认500
     *
     * @see ReConsumeInvoker#DEFAULT_SIZE
     */
    private String fetchSize;

    /**
     * 阈值
     */
    private String threshold;


    public void initMqConfigReconsume() {
        MqConfig.setConfigOrDefault(MqConfig.RECONSUME_THREAD_SLEEP_MILLI, this.sleepMilli);
        MqConfig.setConfigOrDefault(MqConfig.RECONSUME_FETCH_SIZE, this.fetchSize);
        MqConfig.setConfigOrDefault(MqConfig.RECONSUME_THRESHOLD, this.threshold);
    }

}
